<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!<DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="/style/basic_layout.css" rel="stylesheet" type="text/css">
    <link href="/style/common_style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script type="text/javascript" src="/js/plugins/artDialog/jquery.artDialog.js?skin=blue"></script>
    <script type="text/javascript" src="/js/plugins/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="/js/commonAll.js"></script>
    <title>叩丁狼教育PSS（演示版）-订单管理</title>
    <style>
        .alt td {
            background: black !important;
        }
    </style>
    <script>
        $(function () {
            //绑定事件
            $(".btn_audit").click(function () {
                var url = $(this).data("url");
                $.dialog({
                    title: "提示",
                    content: "是否审核这条订单",
                    cancel: true,
                    ok: function () {
                        $.get(url, function (data) {
                            if (data.success) {
                                $.dialog({
                                    title: "提示",
                                    content: data.msg,
                                    ok: function () {
                                        //刷新页面
                                        window.location.reload(true)
                                    }
                                })
                            } else {
                                $.dialog({
                                    title: "提示",
                                    content: data.msg,
                                    ok: true
                                });
                            }
                        });
                    },
                })
            })
        })
    </script>
    <script>
        $(function () {
            $("[name=startTime]").click(function () {
                WdatePicker({
                    dateFmt:"yyyy-MM-dd",
                    maxDate:$("[name=finalTime]").val()
                    });
                })
            $("[name=finalTime]").click(function () {
                WdatePicker({
                    dateFmt:"yyyy-MM-dd",
                    minDate:$("[name=startTime]").val()
                });
            })
        })

    </script>
</head>
<body>
<form id="searchForm" action=/stockOutcomeBill/list.do method="post">
    <div id="container">
        <div class="ui_content">
            <div class="ui_text_indent">
                <div id="box_border">
                    <div id="box_top">搜索</div>
                    <div id="box_center">
                        开始时间
                        <fmt:formatDate value="${qo.startTime}" pattern="yyyy-MM-dd" var="startTime"/>
                        <input type="text"  class="ui_input_txt02 Wdate" name="startTime" value="${startTime}"/>
                        结束时间
                        <fmt:formatDate value="${qo.finalTime}" pattern="yyyy-MM-dd" var="finalTime"/>
                        <input type="text" class="ui_input_txt02 Wdate" name="finalTime" value="${finalTime}"/>
                        仓库
                        <select class="ui_select01" name="depotNo">
                            <option value="-1">请选择</option>
                            <c:forEach items="${depots}" var="depot">
                                <option value="${depot.id}"<%-- ${depot.id ==result.depot.id? 'selected' :''}--%>>${depot.name}</option>
                            </c:forEach>
                        </select>
                        客户
                        <select class="ui_select01" name="depotNo">
                            <option value="-1">请选择</option>
                            <c:forEach items="${clients}" var="client">
                                <option value="${client.id}"<%-- ${depot.id ==result.depot.id? 'selected' :''}--%>>${client.name}</option>
                            </c:forEach>
                        </select>
                        状态
                        <select class="ui_select01" name="statusNo">
                            <option value="-1" ${qo.statusNo==-1? 'selected' : ''}>请选择</option>
                            <option value="0" ${qo.statusNo==0? 'selected' : ''}>待审核</option>
                            <option value="1" ${qo.statusNo==1? 'selected' : ''}>已审核</option>
                        </select>
                    </div>
                    <div id="box_bottom">
                        <input type="button" value="查询" class="ui_input_btn01 btn_select"/>
                        <input type="button" value="新增" class="ui_input_btn01 btn_input btn_url"
                               data-url="/stockOutcomeBill/input.do"/>
                        <input type="button" value="批量删除" class="ui_input_btn01 btn_deleteAll"
                               data-deleteurl="/stockincomebill/deleteAll.do"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="ui_content">
            <div class="ui_tb">
                <table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                    <tr>
                        <th width="30"><input type="checkbox" id="all"/></th>
                        <th>订单编号</th>
                        <th>业务时间</th>
                        <th>仓库</th>
                        <th>客户</th>
                        <th>总金额</th>
                        <th>总数量</th>
                        <th>录入人</th>
                        <th>审核人</th>
                        <th>状态</th>
                        <th></th>
                    </tr>
                    <tbody>
                    <c:forEach items="${result.data}" var="data">
                        <tr>
                            <td><input type="checkbox" name="IDCheck" class="acb" data-eid="${data.id}"/></td>
                            <td>${data.sn}</td>
                            <td><fmt:formatDate value="${data.vdate}" pattern="yyyy-MM-dd"/></td>
                            <td>${data.depot.name}</td>
                            <td>${data.client.name}</td>
                            <td>${data.totalAmount}</td>
                            <td>${data.totalNumber}</td>
                            <td>${data.inputUser.name}</td>
                            <td>${data.auditor.name}</td>
                            <td>
                                <c:choose>
                                    <c:when test="${data.status==0}">
                                        <span style="color: red">待审核</span>
                                    </c:when>
                                    <c:otherwise>
                                        <span style="color: green">以审核</span>
                                    </c:otherwise>
                                </c:choose>
                            </td>
                            <c:choose>
                            <c:when test="${data.status==0}">
                            <td>
                                <a href="javascript:" class="btn_url" data-url="/stockOutcomeBill/input.do?id=${data.id}">编辑</a>
                                <a href="javascript:" class="btn_audit" data-url="/stockOutcomeBill/audit.do?id=${data.id}">审核</a>
                                <a href="javascript:" class="btn_delete"
                                   data-url="/stockOutcomeBill/delete.do?id=${data.id}">删除</a>
                            </td>
                            </c:when>
                            <c:otherwise>
                                <td>
                                    <a href="javascript:" class="btn_url" data-url="/stockOutcomeBill/views.do?id=${data.id}">查看</a>

                                </td>
                            </c:otherwise>
                            </c:choose>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
            <div class="ui_tb_h30">
                <%@include file="../common/common.jsp" %>
            </div>
        </div>
    </div>
</form>
</body>
</html>
